package com.starxnet.ipn;

import android.R.integer;

public class iPN_API {

	public static final int iPN_Error_Success = 0;
	public static final int iPN_Error_Invalid_AuthCode = -1;
	public static final int iPN_Error_Invalid_Token = -2;
	public static final int iPN_Error_Max_Event = -3;
	public static final int iPN_Error_Event_Exist = -4;
	public static final int iPN_Error_Event_NotExist = -5;
	public static final int iPN_Error_SubscriberID_NotExist = -6;
	public static final int iPN_Error_Internal_Error = -7;
	public static final int iPN_Error_Table_NotExist = -8;
	public static final int iPN_Error_Already_Published = -9;
	public static final int iPN_Error_Already_Subscribed = -10;
	public static final int iPN_Error_Already_Posted = -11;
	public static final int iPN_Error_TimeOut = -1;
	
	
	public static final int iPN_PROTO_TOKEN_SIZE = 160;

	public static native void iPN_Debug(int DebugLevel, String FilePath);

	public static native int iPN_Initialize(String InitString, String AESKey);

	public static native int iPN_DeInitialize();

	public static native int iPN_Publish(String OwnerDID, String EventName,
			String AuthCode, String PostToken, String SubscribeToken,
			int bFlagOpen, String QueryTokenPassword);

	public static native int iPN_UnPublish(String OwnerDID, String EventName,
			String AuthCode, String AESKey);

	public static native int iPN_Post(String PostToken, String AESKey,
			long TimeStamp, String AdditionalInfo);

	public static native int iPN_Subscribe_Email(String SubscribeToken,
			String AESKey, String ToAddress, int[] SubscriberID);

	public static native int iPN_UnSubscribe_Email(String SubscribeToken,
			String AESKey, int SubscriberID);

	public static native int iPN_Subscribe_DirectPush(String SubscribeToken, String AESKey,
			String toAddress, String SubscriberID);

	public static native int iPN_UnSubscribe_DirectPush(String SubscribeToken, String AESKey,
			int SubscriberID);
	
	public static native int iPN_Subscribe_MQTTMessage(String SubscribeToken,
			String AESKey, String ToAddress, int[] SubscriberID);

	public static native int iPN_UnSubscribe_MQTTMessage(String SubscribeToken,
			String AESKey, int SubscriberID);

	public static native int iPN_Subscribe_XinGe(String SubscribeToken,
			String AESKey, String ToAddress, int[] SubscriberID);

	public static native int iPN_UnSubscribe_XinGe(String SubscribeToken,
			String AESKey, int SubscriberID);

	public static native int iPN_Subscribe_Voip(String SubscribeToken,
			String AESKey, String ToAddress, int[] SubscriberID);

	public static native int iPN_UnSubscribe_Voip(String SubscribeToken,
			String AESKey, int SubscriberID);

	public static native int iPN_Subscribe_SMS(String SubscribeToken,
			String AESKey, String ToAddress, int[] SubscriberID);

	public static native int iPN_UnSubscribe_SMS(String SubscribeToken,
			String AESKey, int SubscriberID);

	public static native int iPN_QueryToken(String OwnerDID, String EventName,
			String QueryTokenPassword, byte[] SubscribeToken,
			String AESKey);
	
	public static native int iPN_DirectPush_Wait(String SubscribeToken, String AESKey,
			String toAddress,  String info, int timeout_in_sec);	
       
	static {
		try {
			System.loadLibrary("iPN_API");
		} catch (UnsatisfiedLinkError ule) {
			System.out.println("loadLibrary(iPN_API)," + ule.getMessage());
		}
	}
}
